<?php
include_once('common/header.php');
if($AppUI->id <= 0 || (isset($_SESSION['education']) && ($_SESSION['education'] <= 0))) {
	$this->_redirect(HOST_BACKEND);
}
$intStatus		= $objRequest->getParam('stt', -1);
$intCategoryId	= $objRequest->getParam('cate', 0);
$intEducateId	= $objRequest->getParam('edu', 0);
$intPage		= $objRequest->getParam('page', 1);
$intCancel		= $objRequest->getParam('pcancel', 0);
$intLimit		= $variable['ADMIN_LIMIT']['val'];
$intOff			= (($intPage-1) * $intLimit);
$intTotal		= 0;
$intType		= 0;
$objCategory	= new Category();
$objEcourse		= new Ecourse(); 
$objEducation	= new Education();
if($intEducateId > 0) {
	$_SESSION['ECOURSE_CANCEL'] = 1;	
}
else {
	if(isset($_SESSION['ECOURSE_CANCEL'])) unset($_SESSION['ECOURSE_CANCEL']);
}
if($intCancel) {
	if(isset($_SESSION['ECOURSE_CANCEL'])) unset($_SESSION['ECOURSE_CANCEL']);
	$intEducateId 	= 0;
	$intCategoryId	= 0;
}
# list
$arrResult					= $objEcourse->getAll($AppUI->type, $intStatus, $intEducateId, $intOff, $intLimit, $intTotal);
$this->view->arrResult		= $arrResult;
$this->view->intTotal		= $intTotal;
$this->view->intOffset		= $intOff;
$this->view->intLimit		= $intLimit;
$this->view->arrCate		= $objCategory->getParent(EDUCATION_TYPE);
$this->view->arrEdu			= $objEducation->getAllByCate($intCategoryId, $intLanguage);
$this->view->strUrl			= Ecore_Function::getUrl(HOST_BACKEND);
$this->view->arrStatus		= ($AppUI->type == ROOT_ROLE) ? $arrStatusAd : $arrStatus;
$this->view->intLanguage	= $intLanguage;
$this->view->intStatus		= $intStatus;
$this->view->intCategoryId	= $intCategoryId;
$this->view->intEducateId	= $intEducateId;
$this->view->arrUnitT		= $arrUnitT;